import Quill from 'quill';
import Mind from '../../shared/mind';

const BlockEmbed = Quill.import('blots/block/embed');

class MindBlot extends BlockEmbed {
  static blotName = 'mind';
  static tagName = 'div';
  static className = 'jsmind-container';

  static create(value): any {
    const node = super.create(value);
    const { width, height } = value;

    if (width !== undefined) {
      node.style.width = width;
    }
    if (height !== undefined) {
      node.style.height = height;
    }
    console.log('node:', node);
    const mind = new Mind(node);
    console.log('mind:', mind);
    return node;
  }
}

export default MindBlot;
